using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class PKT_SummaryBatchMap : EntityTypeConfiguration<PKT_SummaryBatch>
    {
        public PKT_SummaryBatchMap()
        {
            // Primary Key
            this.HasKey(t => new { t.spid, t.id });

            // Properties
            this.Property(t => t.spid)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(t => t.Acct)
                .HasMaxLength(40);

            this.Property(t => t.Sbatch)
                .HasMaxLength(8);

            this.Property(t => t.Description)
                .HasMaxLength(100);

            this.Property(t => t.Batch)
                .HasMaxLength(8);

            this.Property(t => t.CostCenter)
                .HasMaxLength(30);

            // Table & Column Mappings
            this.ToTable("PKT_SummaryBatch");
            this.Property(t => t.spid).HasColumnName("spid");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.Acct).HasColumnName("Acct");
            this.Property(t => t.Sbatch).HasColumnName("Sbatch");
            this.Property(t => t.Description).HasColumnName("Description");
            this.Property(t => t.Batch).HasColumnName("Batch");
            this.Property(t => t.Date).HasColumnName("Date");
            this.Property(t => t.Debit).HasColumnName("Debit");
            this.Property(t => t.Credit).HasColumnName("Credit");
            this.Property(t => t.Debit_B1).HasColumnName("Debit_B1");
            this.Property(t => t.Credit_B1).HasColumnName("Credit_B1");
            this.Property(t => t.Debit_B2).HasColumnName("Debit_B2");
            this.Property(t => t.Credit_B2).HasColumnName("Credit_B2");
            this.Property(t => t.CostCenter).HasColumnName("CostCenter");
        }
    }
}
